/**
 * Created by wzq on 15-3-28.
 */

var mongodb = require('./mongodb.js');
var Schema = mongodb.Schema;

var commentSchema = new Schema({

  author_id: String,
  author_name: String,
  author_avatar: String,

  //
  share_id: String,
  content: String,
  verify_status: String,

  //
  created_at: Date,
  updated_at: {
    type: Date,
    default: Date.now
  }
});

commentSchema.pre('save', function(next) {
  var currentDate = new Date();
  if (!this.created_at) {
    this.created_at = currentDate;
  }
  next();
});

var Comment = mongodb.model('Comment', commentSchema);

module.exports = Comment;
